﻿<Window x:Class="Gao.Poker.App.Win.ConsumptionWin"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="商品消费" WindowStartupLocation="CenterScreen" ResizeMode="NoResize"  Width="800">
    <Grid Margin="10">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="2*"/>
            <ColumnDefinition Width="7*"/>
            <ColumnDefinition Width="1*"/>
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="30"/>
            <RowDefinition Height="30"/>
            <RowDefinition Height="30"/>
            <RowDefinition Height="30"/>
            <RowDefinition Height="150"/>
            <RowDefinition Height="30"/>
            <RowDefinition Height="30"/>
            <RowDefinition Height="*"/>
            <RowDefinition Height="50"/>
        </Grid.RowDefinitions>

        <TextBlock Grid.Row="0" Grid.Column="0" Text="会员卡号：" Margin="1" VerticalAlignment="Center" HorizontalAlignment="Right"/>
        <TextBox Grid.Row="0" Grid.Column="1" Text="{Binding Path=CardNo}" Margin="1" VerticalContentAlignment="Center" />
        <Button Grid.Row="0" Grid.Column="2" Width="60" Content="查询" Click="MemberSearch_Click" Margin="10,1,1,1" Style="{DynamicResource Orrange}" HorizontalAlignment="Left"/>
        
        <TextBlock Grid.Row="1" Grid.Column="0" Text="会员姓名：" Margin="1" VerticalAlignment="Center" HorizontalAlignment="Right"/>
        <TextBlock Grid.Row="1" Grid.Column="1" Text="{Binding Path=Member.Name}" Margin="1" VerticalAlignment="Center" />

        <TextBlock Grid.Row="2" Grid.Column="0" Text="会员积分：" Margin="1" VerticalAlignment="Center" HorizontalAlignment="Right"/>
        <TextBlock Grid.Row="2" Grid.Column="1" Text="{Binding Path=Member.Points}" Margin="1" VerticalAlignment="Center" />

        <TextBlock Grid.Row="3" Grid.Column="0" Text="商品编号：" Margin="1" VerticalAlignment="Center" HorizontalAlignment="Right"/>
        <TextBox Grid.Row="3" Grid.Column="1" Text="{Binding Path=BarCode}" Margin="1" VerticalContentAlignment="Center" />
        <Button Grid.Row="3" Grid.Column="2" Width="60" Click="ProductSearch_Click" Content="查询" Margin="10,1,1,1" Style="{DynamicResource Orrange}" HorizontalAlignment="Left"/>

        <DataGrid  Grid.Row="4" Grid.Column="1"  Margin="1" RowHeight="30" Name="dgRight"  AutoGenerateColumns="False" 
                      SelectionMode="Single"  CanUserAddRows="True" CellStyle="{StaticResource Body_Content_DataGrid_Centering}"
                      AlternatingRowBackground="Gainsboro" ItemsSource="{Binding Path=ConsumptionProducts}"  AlternationCount="2"
                      FontSize="16" Height="Auto" CellEditEnding="dgRight_CellEditEnding" LostFocus="dgRight_LostFocus">
            <DataGrid.Columns>
                <DataGridTextColumn Header="编码" Width="60" IsReadOnly="True" HeaderStyle="{StaticResource CenterAlignmentColumnHeaderStyle}" Binding="{Binding Path=BarCode}"/>
                <DataGridTextColumn Header="商品名称" Width="*" IsReadOnly="True" HeaderStyle="{StaticResource CenterAlignmentColumnHeaderStyle}" Binding="{Binding Path=ProductName}"/>
                <DataGridTextColumn Header="单价" Width="60" IsReadOnly="True" HeaderStyle="{StaticResource CenterAlignmentColumnHeaderStyle}" Binding="{Binding Path=PPrice}"/>
                <DataGridTextColumn Header="库存" Width="60" IsReadOnly="True" HeaderStyle="{StaticResource CenterAlignmentColumnHeaderStyle}" Binding="{Binding Path=PNumber}"/>
                <DataGridTextColumn Header="购买数量" Width="80" HeaderStyle="{StaticResource CenterAlignmentColumnHeaderStyle}" Binding="{Binding Path=Number}"/>
                <DataGridTextColumn Header="折扣" Width="80" HeaderStyle="{StaticResource CenterAlignmentColumnHeaderStyle}" Binding="{Binding Path=Discount}"/>
                <DataGridTextColumn Header="总计" Width="60" HeaderStyle="{StaticResource CenterAlignmentColumnHeaderStyle}" Binding="{Binding Path=Total}"/>
            </DataGrid.Columns>
        </DataGrid>

        <TextBlock Grid.Row="5" Grid.Column="0" Text="金额总计：" Margin="1" VerticalAlignment="Center" HorizontalAlignment="Right"/>
        <TextBox Grid.Row="5" Grid.Column="1" Text="{Binding Path=Monetary}" Margin="1" VerticalContentAlignment="Center" />
        
        <StackPanel Orientation="Horizontal" Grid.ColumnSpan="2"  Grid.Row="8" Margin="5" VerticalAlignment="Center" HorizontalAlignment="Center">
            <Button Padding="5" Style="{DynamicResource Orrange}" Width="60" FontSize="16" Height="35" Name="btnLogin" 
                    Click="Submit_Click">确认</Button>
        </StackPanel>
    </Grid>
</Window>
